//
//  WJCarBrand.m
//  JerryIos
//
//  Created by jerrywang on 2018/2/4.
//  Copyright © 2018年 王军. All rights reserved.
//

#import "WJCarBrand.h"
#import "WJCar.h"

@implementation WJCarBrand

+(instancetype) carBrandWithDict:(NSDictionary *)dict {
    return [[WJCarBrand alloc] initWithDict:dict];
}

-(instancetype) initWithDict:(NSDictionary *)dict {
    if (self = [super init]) {
        self.title = dict[@"title"];
        
        NSArray *dictArray = dict[@"cars"];
        NSMutableArray *carArray = [NSMutableArray array];
        for (NSDictionary *dict in dictArray) {
            WJCar *car = [WJCar carWithDict:dict];
            [carArray addObject:car];
        }
        _carArray = carArray;
    }
    return self;
}

@end
